package com.itheima.scan.aspectj;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

import java.util.Date;

@Aspect
@Component
public class FlyAspect {
    @Pointcut("execution(* com.itheima.scan.beans.*.*(..))")
//    @Pointcut("execution(* com.itheima.jdk.*.*(..))")
    private void myPointCut() {}

    @Before("myPointCut()")
    public void checkTemperature() {
        System.out.println("正在检查体温……");
    }

    @AfterReturning("myPointCut()")
    public void log() {
        System.out.println("正在登记飞行时间：" + new Date());
    }
}
